package com.common;

import edu.mit.mobile.android.imagecache.ImageCache;
import edu.mit.mobile.android.imagecache.ImageLoaderAdapter;
import edu.mit.mobile.android.imagecache.SimpleThumbnailAdapter;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.swtplayer.R;

import android.content.Context;
import android.widget.SimpleAdapter;

public class GalleryDataAdapter  {

	private Context _context;
	private List<Map<String, Object>> data=new ArrayList<Map<String,Object>>();
	public GalleryDataAdapter(Context context,
			List<Video> vl) { 
		
		_context=context;		
		for(int i=0;i<vl.size();i++)
		{
			Map<String, Object> map = new HashMap<String, Object>();
			map.put("id", vl.get(i).id);
			map.put("title", vl.get(i).title);
			map.put("thumbnail", vl.get(i).thumbnail);
			data.add(map);
		}
		
		
		// TODO Auto-generated constructor stub
	}
	
	public ImageLoaderAdapter GetAdapter()
	{
		ImageCache mCache = ImageCache.getInstance(_context); 
		SimpleAdapter listAdapter =new SimpleThumbnailAdapter(_context, data, R.layout.gallery_view_item,new String[]{"thumbnail", "title", "id" } ,new int[]{ R.id.galleryimg, R.id.gallerytxt},new int[]{ R.id.galleryimg} );
	    ImageLoaderAdapter imgdAdapter=	new ImageLoaderAdapter(_context, listAdapter, mCache, new int[]{R.id.galleryimg},103, 70, ImageLoaderAdapter.UNIT_DIP);
 		return imgdAdapter;
	}
	
	

}